
#ifndef _NetWork_h_2010_10_12_14_36
#define _NetWork_h_2010_10_12_14_36

#include <string>

using namespace std;

struct OutStruct
{
    const char* pPath;
	const char* pFilename;
	FILE* pStream;
	long initsize;
    void* pcurl;
    void* pData;
	OutStruct()
	{
        pFilename = NULL;
        pPath = NULL;
		pStream = NULL;
		initsize = 0;
        pcurl = NULL;
        pData = NULL;
	}
};

class NetWorkImpl
{
public:
	NetWorkImpl();
	virtual ~NetWorkImpl();

	bool FTPGet(const char* purl,const char* pFilePath,bool bResume,long ResumeFileSize,void* pParam);
	bool FTPTest(const char* purl);

	bool HTTPGet(const char* pUrl,void* pParam);

    bool StartTask();
    bool PauseTask();
    bool StopTask();

	static size_t ftp_write_data(void* pPtr, size_t size, size_t realsize, void* pstream);
	static int ftp_prog_cb(void* pPtr, double dltotal, double dlnow, double ult,double uln);

	static size_t http_write_data(void* pPtr, size_t size, size_t realsize, void* pstream);
	static int http_prog_cb(void* pPtr,double dltotal,double dlnow,double ult, double uln);

	static size_t NetWorkImpl::HeaderFunction(void* pPtr,size_t size,size_t nmemb,void* pstream);

	void* m_pcurl;
	OutStruct m_OutStruct;
};

#endif